<?php

/**
 * Created by PhpStorm.
 * Author: ls
 * Time: 2023/8/31 11:48
 * Desc: 订单完成
 */
class Listener_Finance_Withdraw_Create extends Listener_Base
{
    public function handle($args)
    {
        $self       = new self();
        $self->args = $args;
        //判断队列是否开启,如果开启则把任务推送到队列
        if ($self->queue_status) {
            //推送到队列执行
            Queue::in('default', Listener_Finance_Withdraw_Create::class, $args);
        } else {
            $self->perform();
        }
    }


    public function perform()
    {
        $withdraw_info =  $this->args;

        //发短信给管理员
        $sms = St_SMSService::send_withdraw_msg(NoticeCommon::WITHDRAWAL,$withdraw_info);
        $email = St_EmailService::send_withdraw_email(NoticeCommon::WITHDRAWAL,$withdraw_info);
        $qywx = St_QywxService::send_withdraw_qywx( NoticeCommon::WITHDRAWAL, $withdraw_info);
        St_Log::write('提现通知',$sms, 'event/withdraw/sms');
        St_Log::write('提现通知',$email, 'event/withdraw/email');
        St_Log::write('提现通知',$qywx, 'event/withdraw/qywx');
    }
}